package com.bdqn;


import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;

public class JedisTester {
    private Jedis jedis;

    @Before
    public void setup(){
        //连接redis服务器 指定IP以及端口号
        jedis=new Jedis("127.0.0.1",6380);
        //指定密码
        jedis.auth("123456");
    }

    @Test
    public void testString(){
        jedis.set("ni","ktjy");
        System.out.println(jedis.get("ni"));

        jedis.append("ni","2020");
        System.out.println(jedis.get("ni"));

        jedis.del("ni");
        System.out.println(jedis.get("ni"));

        jedis.mset("na","ktjy","age","17","add","cz");
        jedis.incr("age"); //进行+1操作
        System.out.println(jedis.get("na")+"----"+jedis.get("age")+"-----"+jedis.get("add"));
    }
}
